HudTexT1 = "-Server-"
HudTexT2 = "-"..game("sv_name").."-"
HudMinuTe1 = "-Tank Mod-"
HudMinuTe2 = "-Version 1.0-"
HudMinuTe3 = "-Have Fun-"

-------------- Colors --------------
-------------- Voe pode adicionar novas cores aqui --------------
-------------- You can add more colors here --------------

rosa = "255000100"
verde = "000255000"
azul = "000000255"
vermelho = "255000000"
cinza = "147147147"
amarelo = "255255000"
laranja = "255100000"
violeta = "100011255"
roxo = "128000128"
branco = "255255255"
preto = "000000000"

pink = "255000100"
green = "000255000"
blue = "000000255"
red = "255000000"
gray = "147147147"
yellow = "255255000"
orange = "255100000"
violet = "100011255"
purple = "128000128"
white = "255255255"
black = "000000000"

-------------- Hud Position --------------
-------------- Voe pode adicionar mais posies se quiser --------------
-------------- You can addd more positions here --------------
-------------- The number 1 is to the first hud the 2 is for the second --------------

down1 = "1 425"
down2 = "1 410"
up1 = "275 20"
up2 = "262 35"
rigth1 = "20 175"
rigth2 = "1 190"



-------------- No mude nada aqui apenas se souber oque esta fazendo !!! --------------
-------------- Do not change anything here only if you know WHAT are you doing!!! -------------- 


addhook("ms100","HudTxT")
                                                                                                 function HudTxT()
                                                                                                                                                        for id=1,32 do
                                                                                                                                                                                                   if player(id,'exists') then
      parse('hudtxt2 '..id..' 1 "'..azul..' '..HudTexT1..'"'..up1..'')
      parse('hudtxt2 '..id..' 2 "'..verde..' '..HudTexT2..'"'..up2..'')
                                                                                                                                                                                                   end
                                                                                                end
end


addhook("minute","HudMinuTe")
                                                                                                 function HudMinuTe()
      msg(""..roxo.." "..HudMinuTe1.."")
      msg(""..vermelho.." "..HudMinuTe2.."")
      msg(""..verde.." "..HudMinuTe3.."")
end

addhook("say","HudRanK")
                                                                                                 function HudRank(id,txt)
                                                                                                                                                                             if txt == "rank" or txt == "RANK" then
                                                                                                                                                                             return 0
                                                                                                                                                                             else
                                                                                                                                                                             end
end


function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end
level=initArray(32)
exp=initArray(32)

function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end

function totable(t,match)
     local cmd = {}
     if not match then match = "[^%s]+" end
     for word in string.gmatch(t, match) do
          table.insert(cmd, word)
     end
     return cmd
end 

addhook("ms100","save_hud")
function save_hud()
     for id = 1,32 do
          if (player(id,"exists")) then
               parse('hudtxt2 '..id..' 48 "255000000Level: '..level[id]..' " 13 117')
               parse('hudtxt2 '..id..' 49 "255000000Exp: '..exp[id]..'/100 " 13 129')
          end
     end
end


if sample==nil then sample={} end
sample.hudtxt={}
sample.hudtxt.timer=0

addhook("second","sample.hudtxt.second")
function sample.hudtxt.second()
	sample.hudtxt.timer=sample.hudtxt.timer+1
	if sample.hudtxt.timer>=5 then
		sample.hudtxt.timer=0
   parse('hudtxt 18 "255255255eadAce [ Creator ]" 6 406 0')
   parse('hudtxt 20 "255255255CrackDown [ Editor ]" 6 422 0')
   end
end

addhook("ms100","hudinfo")
function hudinfo()
for id=1,32 do 
if player(id,"exists") then
parse('hudtxt2 '..id..' 7 " 255255255Health:'..player(id,'health')..'" 290 300 8')
parse('hudtxt2 '..id..' 8 " 255255255Armor:'..player(id,'armor')..'" 290 287 8')
end
end
end

sd = {}

function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

sd.damage = initArray(32)
sd.showtimer = initArray(32)

addhook('hit','sd.hit')
function sd.hit(id,src,wpn,hp)
	if hp > 0 then
		sd.damage[src] = sd.damage[src] + hp
		sd.show(src)
		sd.showtimer[src] = 10
	end
end

function sd.show(id)
parse('hudtxt2 '..id..' 0 "255255255-'..sd.damage[id]..' HP" 300 200 -1')
end

addhook('ms100','sd.check')
function sd.check()
	for i = 1,32 do
		if player(i,'exists') then
			if sd.showtimer[i] > 0 then
				sd.showtimer[i] = sd.showtimer[i] - 1
			else
				sd.damage[i] = 0
				parse('hudtxt2 '..i..' 0 "" 320 240 0')
			end
		end
	end
end



addhook("say","off")
function off(id,txt)
if txt == "!afk" then
msg("255255255 O Jogador " .. player(id, 'name') .. " AFK. @C")
end
end

addhook("join","offd")
function offd(id,txt)
msg("255255255 O Jogador " .. player(id, 'name') .. " Entrou no servidor. @C")
end


addhook("ms100","Slpk")
function Slpk()
for id=1,32 do 
if player(id,"exists") then
parse('hudtxt2 '..id..' 4 " 255255255USGN: '..player(id,'usgn')..'" 350 422')
end
end
end
